#ifndef SERVER_H_20111222
#define SERVER_H_20111222

#include "NetworkDefine.h"
#include "Boxer.h"


class CBoxerServer
{
public:
	float m_xPos, m_yPos;
	long  m_hp;
	long  m_sprite;
	ClientSide m_side;
    float m_dodgePara;
};

class CServer;

class CBoxerContainer
{
public:

	void SetPlayers(CBoxerServer *pBoxerDown, CBoxerServer *pBoxerUp)
	{
		m_pBoxerUp = pBoxerUp;
		m_pBoxerDown = pBoxerDown;
	}

	void SetObserver(CServer *pObserver) {m_pObserver = pObserver;}
	void Attack(CBoxerServer *pBoxer, bool bLeftFist);

	void MoveLeft(CBoxerServer *pBoxer);
	void MoveRight(CBoxerServer *pBoxer);

	void Dodge(CBoxerServer *pBoxer);
	void DodgeToNormal(CBoxerServer *pBoxer);

	void Dead(CBoxerServer *pBoxer);

private:
	CBoxerServer *m_pBoxerUp;
	CBoxerServer *m_pBoxerDown;
	CServer      *m_pObserver;
};

class CClient;

class CServer
{
public:
	static CServer *GetInstance();
	void SetClientHelper(CClient *pClient)
    {
        m_pClient = pClient;
    }

    void ReceiveCommand(const ClientPacket &p);
	void BoxerHurt(CBoxerServer *pBoxer, long hpCost, float xPos, float yPos);
	void BoxerDead(CBoxerServer *pBoxer);
private:
	CServer();
	
	GameInfo &MakeServerPacket();
private:
	CBoxerServer    m_players[2];
	CBoxerContainer m_boxers;
	CClient        *m_pClient;
	int             m_playerNum;
	
};
#endif